Template-like constructions Bantuan:Templat

Any Wikimedia page can be transcluded, and this allows for constructions that are not technically templates, but share some of the features of them.

Composite pages

The wikitext of a page may (partly or fully) consist of tags for the inclusion of component pages. The component pages are usually not in the template namespace, and are often full pages in their own right. Composite pages are intended to gather the material on them into a central location.

Examples are:

This allows the choice between viewing the component pages separately or together. Viewing a composite page is convenient when there are many small, related component pages, in that it allows an overview of all the components without the effort of following numerous links.

in general, each component page and the composite page are treated separately. While the actual changes on the component pages will be transcluded onto the composite page, the edit history, recent changes, page-watch settings, page protection, TOC, "what links here" link, and other Wikimedia features of the composite page do not reflect or affect the histories, watch settings, protection levels, what links here lists of the component pages. The composite page is a page in its own right. The talk page of a composite page is used to talk about the composition and the page in general, not the component pages, though it in turn could be a composite of the talk pages of the component pages.

Editing a section of a component page can be done directly from the composite page, see editing sections of included templates. After saving, one ends up at the page for the component page to which the section belongs.

On projects with the interlanguage link feature the composite page shows the combined interlanguage links of all component pages, hence possibly multiple links for one language or even for one page.

See also Wikipedia talk:Template namespace#transcluding prose.

Pages with a common section

When two pages need to discuss the same material in the same way, they can share a section. This involves creating a third page and transcluding that page onto both pages. This third page may be a page in its own right or a subpage of either of the other two, and if the first it may be placed in the same namespace as the other pages or in template namespace. Common sections like this should be marked with an explanatory header, and/or given a special layout, to inform the reader that this section of the page is in a different location. They can easily confuse editors and readers alike if they aren't.

Examples:

Repetition within a page

On pages where there is a lot of repetitive information - various kinds of lists, usually - it is sometimes useful to make a template which contains the repeating text, and then call that template multiple times. For example, Template:List of Languages calls Template:Lang def repeatedly with different parameters in order to generate the visible text.

Simple repetition of the same text be handled with repetition of a parameter in a single template: e.g. {{3x}}, where {{3x| howdy!}} produces Templat:3x.

There is no real looping functionality built into the Mediawiki software as of this time (see, however, {{for loop}}), but there are some tricks for mimicking them. For instance, repeatedly calling a template which repeatedly calls a different template can mimic a double loop (see e.g. , , and ). Templates can also be coerced into calling themselves (normally prohibited by the Mediawiki software past a single instance, to prevent infinite loops), by the artful use of redirects (see m:Template:Loop1 (backlinks, edit)See also m:Help:Recursive conversion of wikitext.